package org.dallasrowing.model;

import java.util.Date;

public class DamageEntry {

	private int id;
	private String part;
	private Date createDate;
	private Boat boat;
	private String description;
	private Date damageCloseDate;

	public DamageEntry() {
		/* for SqlMap */
	}
	
	public DamageEntry(int id, Boat boat, String part, String description, Date createDate) {
		setId(id);
		setPart(part);
		setBoat(boat);
		setDescription(description);
		setCreateDate(createDate);
	}

	public String getPart() {
		return this.part;
	}

	public Boat getBoat() {
		return this.boat;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public String getDescription() {
		return description;
	}

	private void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	private void setDescription(String description) {
		this.description = description;
	}

	private void setBoat(Boat boat) {
		this.boat = boat;
	}

	private void setPart(String part) {
		this.part = part;
	}

	public int getId() {
		return id;
	}

	private void setId(int id) {
		this.id = id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((boat == null) ? 0 : boat.hashCode());
		result = prime * result
				+ ((createDate == null) ? 0 : createDate.hashCode());
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + id;
		result = prime * result + ((part == null) ? 0 : part.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final DamageEntry other = (DamageEntry) obj;
		if (boat == null) {
			if (other.boat != null)
				return false;
		} else if (!boat.equals(other.boat))
			return false;
		if (createDate == null) {
			if (other.createDate != null)
				return false;
		} else if (!createDate.equals(other.createDate))
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (id != other.id)
			return false;
		if (part == null) {
			if (other.part != null)
				return false;
		} else if (!part.equals(other.part))
			return false;
		return true;
	}

	public String toString() {
		return new StringBuilder()
				.append("Part: ").append(part).append("\n")
				.append("Description: ").append(description).append("\n")
				.append("Create Date: ").append(createDate).append("\n")
				.append("Boat: ").append(boat).append("\n")
				.toString();
	}

	public void setDamageCloseDate(Date timeStamp) {
		this.damageCloseDate = timeStamp;
	}
	
	public Date getDamageCloseDate()
	{
		return this.damageCloseDate;
	}
}
